/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.model.item.etcitem.action;

import com.lineage.server.PacketCreate;
import com.lineage.server.model.L1Teleport;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.item.ItemExecutor;

/**
 * Class <code>TeleportsArrogantTowerAmulet</code> 傲慢之塔传送符.<br>
 * 傲慢之塔传送符(11F) - 40289 <br>
 * 傲慢之塔传送符(21F) - 40290 <br>
 * 傲慢之塔传送符(31F) - 40291 <br>
 * 傲慢之塔传送符(41F) - 40292 <br>
 * 傲慢之塔传送符(51F) - 40293 <br>
 * 傲慢之塔传送符(61F) - 40294 <br>
 * 傲慢之塔传送符(71F) - 40295 <br>
 * 傲慢之塔传送符(81F) - 40296 <br>
 * 傲慢之塔传送符(91F) - 40297 <br>
 * 
 * @author jrwz
 * @version 2012-6-23下午01:09:31
 * @see com.lineage.server.model.item.etcitem.action
 * @since JDK1.7
 */
public final class TeleportsArrogantTowerAmulet extends ItemExecutor {

    /**
     * 取得实例.
     * 
     * @return 实例
     */
    public static ItemExecutor get() {
        return new TeleportsArrogantTowerAmulet();
    }

    /** 傲慢之塔传送符. */
    private TeleportsArrogantTowerAmulet() {
    }

    @Override
    public void execute(final L1PcInstance pc, final L1ItemInstance useItem,
            final int readC1, final int readC2, final int targetId,
            final int targetX, final int targetY) {
        final int itemId = useItem.getItemId();
        boolean isTeleport = false;
        final int x = pc.getX();
        final int y = pc.getY();
        final int map = pc.getMapId();

        switch (itemId) {
            case 40289: // 傲慢之塔传送符(11F)
                if ((x >= 32816) && (x <= 32821) && (y >= 32778)
                        && (y <= 32783) && (map == 101)) {
                    L1Teleport.teleport(pc, 32631, 32935, 111, 5, true);
                } else {
                    isTeleport = true;
                }
                break;
            case 40293: // 傲慢之塔传送符(51F)
                // 傲慢之塔1层上方魔法阵
                if ((x >= 32816) && (x <= 32821) && (y >= 32778)
                        && (y <= 32783) && (map == 101)) {
                    L1Teleport.teleport(pc, 32669, 32814, 151, 5, true);
                } else {
                    isTeleport = true;
                }
                break;

            case 40290: // 傲慢之塔传送符(21F)
                // 傲慢之塔1层右方魔法阵
                if ((x >= 32815) && (x <= 32820) && (y >= 32815)
                        && (y <= 32820) && (map == 101)) {
                    L1Teleport.teleport(pc, 32631, 32935, 121, 5, true);
                } else {
                    isTeleport = true;
                }
                break;
            case 40294: // 傲慢之塔传送符(61F)
                // 傲慢之塔1层右方魔法阵
                if ((x >= 32815) && (x <= 32820) && (y >= 32815)
                        && (y <= 32820) && (map == 101)) {
                    L1Teleport.teleport(pc, 32669, 32814, 161, 5, true);
                } else {
                    isTeleport = true;
                }
                break;

            case 40291: // 傲慢之塔传送符(31F)
                // 傲慢之塔1层左方魔法阵
                if ((x >= 32779) && (x <= 32784) && (y >= 32778)
                        && (y <= 32783) && (map == 101)) {
                    L1Teleport.teleport(pc, 32631, 32935, 131, 5, true);
                } else {
                    isTeleport = true;
                }
                break;
            case 40295: // 傲慢之塔传送符(71F)
                // 傲慢之塔1层左方魔法阵
                if ((x >= 32779) && (x <= 32784) && (y >= 32778)
                        && (y <= 32783) && (map == 101)) {
                    L1Teleport.teleport(pc, 32669, 32814, 171, 5, true);
                } else {
                    isTeleport = true;
                }
                break;

            case 40292: // 傲慢之塔传送符(41F)
                // 傲慢之塔1层下方魔法阵
                if ((x >= 32779) && (x <= 32784) && (y >= 32815)
                        && (y <= 32820) && (map == 101)) {
                    L1Teleport.teleport(pc, 32631, 32935, 141, 5, true);
                } else {
                    isTeleport = true;
                }
                break;
            case 40296: // 傲慢之塔传送符(81F)
                // 傲慢之塔1层下方魔法阵
                if ((x >= 32779) && (x <= 32784) && (y >= 32815)
                        && (y <= 32820) && (map == 101)) {
                    L1Teleport.teleport(pc, 32669, 32814, 181, 5, true);
                } else {
                    isTeleport = true;
                }
                break;

            case 40297: // 傲慢之塔传送符(91F)
                // 傲慢之塔90层右方魔法阵
                if ((x >= 32706) && (x <= 32710) && (y >= 32909)
                        && (y <= 32913) && (map == 190)) {
                    L1Teleport.teleport(pc, 32669, 32814, 191, 5, true);
                } else {
                    isTeleport = true;
                }
                break;
            default:
                break;
        }

        if (isTeleport) {
            PacketCreate.get().sendSinglePackets(pc, "没有任何事情发生");
        }
    }
}
